Skip to content

fix: compatible with derive_more 2.1.0#272

Merged
gibbz00 merged 1 commit into
gibbz00:mainfrom
jdx:fix-derive-more-2.1-compatibility
Dec 17, 2025
Merged

fix: compatible with derive_more 2.1.0#272
gibbz00 merged 1 commit into
gibbz00:mainfrom
jdx:fix-derive-more-2.1-compatibility

Conversation

@jdx

@jdx jdx commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Summary

The derive_more 2.1.0 release includes a fix for "Missing trait bounds in AsRef/AsMut derives when associative types are involved" (#474).

This fix adds additional where clauses to the generated impl blocks that require GenericArray to implement AsRef for itself, which it doesn't. This causes a compilation error in rops:

error[E0599]: the method `as_ref` exists for reference `&authorization_tag::AuthorizationTag<aes256_gcm::AES256GCM>`, but its trait bounds were not satisfied
  --> crates/lib/src/cryptography/cipher/aes256_gcm.rs:46:31
   |
46 |             authorization_tag.as_ref(),
   |                               ^^^^^^ method cannot be called due to unsatisfied trait bounds

This PR replaces the derived AsRef with a manual implementation to avoid the trait bound issue while maintaining the same functionality.

Changes

  • Remove AsRef from the derive macro on AuthorizationTag
  • Add manual impl AsRef<Tag<C::AuthorizationTagSize>> for AuthorizationTag<C>

Test Plan

  • All 128 lib tests pass
  • All 7 parity tests pass

This was discovered when mise's lockfile maintenance PR updated derive_more from 2.0.1 to 2.1.0: jdx/mise#7211

🤖 Generated with Claude Code

The derive_more 2.1.0 release includes a fix for 'Missing trait bounds in
AsRef/AsMut derives when associative types are involved' (#474).

This fix adds additional where clauses to the generated impl blocks that
require GenericArray to implement AsRef for itself, which it doesn't.

Replace the derived AsRef with a manual implementation to avoid the
trait bound issue while maintaining the same functionality.
@codecov

codecov Bot commented Dec 15, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.13%. Comparing base (18772a5) to head (69055c4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
- Coverage   96.20%   96.13%   -0.08%     
==========================================
  Files          80       80              
  Lines        3136     3076      -60     
==========================================
- Hits         3017     2957      -60     
  Misses        119      119              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gibbz00

gibbz00 commented Dec 17, 2025

Copy link
Copy Markdown
Owner

Weird, I thought I responded and merged this a couple of days ago. Oh well, apologies for the late response.

PR looks good, thanks! Bit bummed though that they forced trait bounds on generic parameters which aren't used. That's not a minor version bump under "fixes" 😅

@gibbz00 gibbz00 merged commit 55e3005 into gibbz00:main Dec 17, 2025
10 of 13 checks passed
@jdx

jdx commented Dec 17, 2025

Copy link
Copy Markdown
Contributor Author

yeah definitely, at least the fix wasn't too bad in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants